<template>
  <div>
    <el-form-item label="院系" prop="deptId">
      <el-select v-model="deptId" placeholder="请选择院系" disabled>
        <el-option
          v-for="dict in getIntDictOptions(DICT_TYPE.DEPT_ID)"
          :key="dict.value"
          :label="dict.label"
          :value="dict.value"
        />
      </el-select>
    </el-form-item>
    <el-form-item label="教师工号" prop="teacherNumber">
      <el-input v-model="teacherNumber" disabled />
    </el-form-item>
    <el-form-item label="教师姓名" prop="teacherName">
      <el-input v-model="teacherName" disabled />
    </el-form-item>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { getUserProfile } from '@/api/system/user/profile'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'

const deptId = ref('')
const teacherNumber = ref('')
const teacherName = ref('')

onMounted(async () => {
  await fetchData()
})

const fetchData = async () => {
  try {
    // 这里添加获取数据的逻辑，根据您的实际情况获取部门ID、教师工号和教师姓名数据
    // 示例代码：
    const userInfo = await getUserProfile()
    deptId.value = userInfo.dept.id
    teacherNumber.value = userInfo.username
    teacherName.value = userInfo.nickname
  } catch (error) {
    console.error('Failed to fetch user data:', error)
  }
}
</script>
